<ng-template #img>
  <img *ngIf="displayImage()" [class]="classes" [src]="previewImage || avatarUrl || defaultAvatarUrl" alt="" />

  <div *ngIf="displayActorInitial()" [ngClass]="classes">
    <span>{{ getActorInitial() }}</span>
  </div>

  <div *ngIf="displayPlaceholder()" [ngClass]="classes"></div>
</ng-template>

<a *ngIf="actor && href" [href]="href" target="_blank" rel="noopener noreferrer" [title]="title">
  <ng-template *ngTemplateOutlet="img"></ng-template>
</a>

<a *ngIf="actor && internalHref" [routerLink]="internalHref" [title]="title">
  <ng-template *ngTemplateOutlet="img"></ng-template>
</a>

<ng-container *ngIf="!actor || (!href && !internalHref)">
  <ng-template *ngTemplateOutlet="img"></ng-template>
</ng-container>
